#!/usr/local/bin/python3.6
# coding:utf-8
# @Time    : 2019/11/20 8:59
# @Author  : ZhangBing
# @Email   : 18829272841@163.com
# @File    : webclient.py
# @Software: PyCharm
import asyncio
import websockets


async def hello():
    uri = "ws://localhost:8765"
    async with websockets.connect(uri) as websocket:
        await websocket.send("Hello world!")
        data = await websocket.recv()
        print(data)


asyncio.get_event_loop().run_until_complete(hello())

if __name__ == "__main__":
    pass
